#include <57header.h>

int main(int argc,char*argv[])
{
    // 设置一个全局屏蔽
    sigset_t set, old;
    sigemptyset(&set);
    sigemptyset(&old);

    sigaddset(&set, 2);

    sigprocmask(SIG_BLOCK, &set, &old);

    printf("sleep1 before \n");
    sleep(10);

    printf("sleep2 before \n");
    sleep(1);

    printf("sleep3 before \n");
    sleep(1);
    printf("sleep3 over \n");

    sigset_t set2, old2;
    sigemptyset(&set2);
    sigemptyset(&old2);

    sigaddset(&set2, 2);
    // 解除阻塞
    sigprocmask(SIG_UNBLOCK, &set2, &old2);
    
    if(sigismember(&old2, 2)){
        printf("old的屏蔽中, 屏蔽了2号信号 \n");
    }

    while(1);
    return 0;
}

